<?php




class Ajax extends CI_Controller{
	
	
	function fetchVotes(){
		
		$data['last'] = $_POST['last'];
		echo get_instance()->load->view('ajax/check_new_support',$data,TRUE);

	}
	
	function ajaxlogin(){
		$data = $_POST;
		get_instance()->load->model('users/User');
		echo get_instance()->User->authenticateUser($data['user-input'], $data['password-input']);
			
	}

	function formlogin(){
		$data = $_POST;
		get_instance()->load->model('users/User');
		$result =  get_instance()->User->authenticateUser($data['user-input'], $data['password-input']);
		if ($result == 'success')	header("Location: $last_url");
		else {
			header('Location: login/fail');
		}
	}

}